// @ts-nocheck
/**
 * @Date: 2022-03-10 12:13:06
 * @LastEditors: sailornpg
 * @LastEditTime: 2022-03-13 17:01:44
 * @FilePath: \zhihuReal\routes\topic.js
 * @Description: 话题路由
 */
const router = require('koa-router')()
router.prefix('/topic')
const {
    auth
} = require('../middlewares/auth')
//控制器
const {
    topicList,
    oneTopic,
    createTopic,
    updateTopic,
    topicFollowerList,
    listQuestions
} = require('../controllers/topicCtl')
const {
    cheackTopicExist
} = require('../middlewares/cheack')
//获取话题列表
router.get('/', topicList)
//获取单个话题
router.get('/:id', cheackTopicExist, oneTopic)
//创建话题
router.post('/', auth, createTopic)
//更新话题
router.patch('/:id', auth, cheackTopicExist, updateTopic)
//获取话题粉丝
router.get('/:id/followerList', cheackTopicExist, topicFollowerList)
//获取话题粉丝
router.get('/:id/questions', cheackTopicExist, listQuestions)

module.exports = router